#include "Budget.h"
#include <iostream>

using namespace std;

Budget::Budget(){
	leftoverBudget = 0;
}

Budget::Budget(double initialIn, double leftoverIn, int p){
}

void Budget::setInitialBudget(double initialIn)
{ 
	initialBudget = initialIn;
	leftoverBudget = initialIn;
}
	
void Budget::setLeftverBudget(double leftoverIn){ 
	leftoverBudget = leftoverIn;
}

void Budget::setp(int p){ 
	priority = p;
}

double Budget::getInitial(){
	return initialBudget;
}
	 
double Budget::getLeftover(){
	return leftoverBudget;
}

int Budget::getp(){
	return priority;
}

void Budget::simpleadd(double expense){ 
	leftoverBudget -= expense; 
}


double Budget::add(double change,double proportion)
{
		leftoverBudget+=change;
		//cout << "left over budget is: " << leftoverBudget << endl;
		if (leftoverBudget < (proportion * initialBudget))
		{
			//cout << "inside if statement" << endl;
			return (proportion * initialBudget) - leftoverBudget;
		}
		else 
			return 0;
}
